<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
	#t1 {
		font-family: "微软雅黑";
		background: url(image/bg.jpg) no-repeat;
		background-size: 120%;
	}
	body {
		background: url(image/bg.jpg) no-repeat;
		background-size: 100%;
	}
	#s1,
	#s2,
	#s3 {
		font-size: 0.5em;
		margin-left: 0.5em;
	}
</style>
<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
</head>

<body>
	<TABLE border=0 cellSpacing=0 cellPadding=0 width=664 align=center>
		<TBODY>
			<TR>
				<TD>
					<TABLE border=0 cellSpacing=1 cellPadding=0 width="100%">
						<TBODY>
							<TR>
								<TD height=100 vAlign=center align=right></TD>
							</TR>
							<TR>
								<TD height=326 vAlign=center align=middle>
									<DIV style="WIDTH: 427px; HEIGHT: 317px">
										<TABLE border=0 cellSpacing=0 cellPadding=0 width=427 height=316 id=t1>
												<TBODY>
													<TR>
														<TD height=50 colSpan=6 valign="center" align="middle">用户注册</TD>
													</TR>
													<TR>
														<TD rowSpan=5 width=100></TD>
														<TD height=1 colSpan=3></TD>
														<TD colSpan=2></TD>
													</TR>
													<TR>
														<TD height=36>
															<SPAN>账&nbsp;&nbsp;号:</SPAN>
														</TD>
														<TD colSpan=2>
															<INPUT id=account class=input maxLength=20 size=23 name=account>
														</TD>
														<TD width=120>
															<span id=s1>3-16位,包括字母,数字以及下划线</span>
														</TD>
													</TR>
													<TR>
														<TD height=36>
															<SPAN>电&nbsp;&nbsp;话:</SPAN>
														</TD>
														<TD colSpan=2>
															<INPUT id=tel class=input maxLength=20 size=23 name=tel>
														</TD>
														<TD width=120>
															<span id=s2></span>
														</TD>
													</TR>
													<TR>
														<TD height=37>
															<SPAN>密&nbsp;&nbsp;码:</SPAN>
														</TD>
														<TD height=37 colSpan=2>
															<INPUT id=pwd class=input maxLength=20 size=23 type=password name=password>
														</TD>
														<TD width=120>
															<span id=s3>6-18位,包括字母,数字以及下划线</span>
														</TD>
													</TR>
													<TR>
															<TD height=36>
																<SPAN>验&nbsp;证&nbsp;码:</SPAN>
															</TD>
															<TD valign="center" marg>
																<INPUT id=checkCode class=input maxLength=8 size=10 name=checkCode>
																&nbsp;<span id=s4><img id=checkImage />&nbsp;</span>
															</TD>
															<TD colSpan=2>
															    <span id=5></span>
															</TD>
														</TR>
													<TR>
														<TD vAlign=center align=middle colSpan=6 height=30>
															<input type="button" value="提交" id="tj" />
														</TD>
													</TR>
													<TR>
														<TD height=30 vAlign=center colSpan=6 align=middle>
															<SPAN class=weizi>Copyright &copy; <A href="#" target=_blank>中深软通</A> 2016 All rights reserved. 
														</TD>
													</TR>
											</TBODY>
										</TABLE>
									</DIV>
								</TD>
							</TR>
						</TBODY>
					</TABLE>
				</TD>
			</TR>
		</TBODY>
	</TABLE>
</body>
<script type="text/javascript">
		function checkCode(){
			 $("#checkImage").attr("src", "code.do?"+Math.random());
		}       
		$(function(){
		checkCode()
		})
	    $("#tj").click(function() {
			var through = true;
			var tel=$("#tel").val();
			var account=$("#account").val();
			var pwd=$("#pwd").val();
			var rsaccount=$("#account").val().match(/^[a-z0-9_-]{3,16}$/gi);
			var rstel = $("#tel").val().match(/^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/gi); //手机号码正则筛选
			var rspwd=pwd.match(/^[a-z0-9_-]{6,18}/gi)
			if (null == account || "" == account) {
				$("#s1").text("账号不能为空").css("color", "red");
				through = false;
			}
			else if(!rsaccount){
				$("#s1").text("输入的账号不合法").css("color", "red");
				through = false;
			}
			if(null == tel|| "" == tel){
				$("#s2").text("号码不能为空").css("color", "red");
				through = false;
			}
			else if (!rstel) {
				$("#s2").text("输入的号码不合法").css("color", "red");
				through = false;
			}
			if(null == pwd|| "" == pwd){
				$("#s3").text("密码不能为空").css("color", "red");
				through = false;
			}
			else if (!rspwd) {
				$("#s3").text("输入的密码不合法").css("color", "red");
				through = false;
			}
			if(through==true){
				$.post("login.do",
	        			{userCellphone:$("input[name='userCellphone']").val(),
	        		     password:$("input[name='password']").val(),                                              
	        			  checkCode:$("input[name='checkCode']").val()},
	        			function(data){
	        				  var data1=parseInt(data)
	        				switch(data1){
	        				case 0:$("#s4").append("验证码错误");
	        				       break;
	        				case 1:location.href="success.jsp";
	        					   break;
	        				case 2:$("#s3").html("密码输入错误");
	        					   break;
	        				case 3:$("#s2").html("用户不存在");
	        			    }
	        	         })
			}
		})
</script>
</html>